<html>
<head><meta charset="utf-8"><title>x.py vs branches · t-compiler · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/index.html">t-compiler</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/x.2Epy.20vs.20branches.html">x.py vs branches</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="165502232"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/x.py%20vs%20branches/near/165502232" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/x.2Epy.20vs.20branches.html#165502232">(May 13 2019 at 06:34)</a>:</h4>
<p>What is the best workflow for working with several branches in the compiler, that avoids rebuilds?</p>
<p>My understanding is that, if you have two branches with different bases, switching between the two and building stuff will constantly re-build a lot of stuff  because  of changes at the base.</p>
<p>I work-around it by having two instances of rust-lang/rust checked out locally, but that is suboptimal.</p>
<p>Is there some way to tell x.py/Cargo to mix branch name into artifact hash?</p>



<a name="165504584"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/x.py%20vs%20branches/near/165504584" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> davidtwco <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/x.2Epy.20vs.20branches.html#165504584">(May 13 2019 at 07:26)</a>:</h4>
<p>I don’t know of a way to make changing branches not require a full build. </p>
<p>I have some local tooling built around keeping a bunch of working directories locally. </p>
<p>I only reuse a directory once the PR that I was working on in it has been merged or closed. The tooling automates the creating of new directories (cloning, symlink my <code>config.toml</code>, clean, build), keeping track of what directories are assigned to what and tidying up after me. I’ve got a cron job that uses the tool to update all the unassigned directories so they have a build of the latest master each night. I can just ask it for a directory to work on X, it keeps track of that, gives me a directory that’s already built and I know I’m at most 24 hours behind master.</p>



<a name="165505023"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/x.py%20vs%20branches/near/165505023" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> detrumi <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/x.2Epy.20vs.20branches.html#165505023">(May 13 2019 at 07:34)</a>:</h4>
<p>Someone <a href="#narrow/stream/187831-t-compiler.2Fwg-self-profile/topic/Docs/near/164243461" title="#narrow/stream/187831-t-compiler.2Fwg-self-profile/topic/Docs/near/164243461">mentioned before</a> that you could use git workspaces for that, but I'm not sure how that works exactly</p>



<a name="165507843"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/x.py%20vs%20branches/near/165507843" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> davidtwco <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/x.2Epy.20vs.20branches.html#165507843">(May 13 2019 at 08:22)</a>:</h4>
<p>I haven't heard of <code>git-workspace</code>, only <code>git-worktree</code>. I can't find anything other than an npm package for <code>git-workspace</code>. </p>
<p>My understanding of <code>git-worktree</code> is that it supports multiple working trees attached to a single repository, saving space as it deduplicates all of the data in the history and stuff like that. I want to add support for that to my tool, I just didn't know it existed when I wrote it. </p>
<p>They both do slightly different things. Using just <code>git-worktree</code> will avoid having multiple clones, but it won't make sure that you have full builds of any of your working trees available and up-to-date. For example, if you made a new worktree with <code>git worktree add</code> then you would still need to run <code>x.py build</code> in that new folder to use it. I'd like to eventually use them together, so that my tool creates the working directories using <code>git-worktree</code> and then keeps them up-to-date and assigns them tasks.</p>



<a name="165550468"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/x.py%20vs%20branches/near/165550468" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/x.2Epy.20vs.20branches.html#165550468">(May 13 2019 at 17:38)</a>:</h4>
<p>Personally I just keep 9 checkouts</p>



<a name="165550474"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/x.py%20vs%20branches/near/165550474" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/x.2Epy.20vs.20branches.html#165550474">(May 13 2019 at 17:38)</a>:</h4>
<p>:)</p>



<a name="165551302"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/x.py%20vs%20branches/near/165551302" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/x.2Epy.20vs.20branches.html#165551302">(May 13 2019 at 17:48)</a>:</h4>
<p><span class="user-mention" data-user-id="116107">@davidtwco</span> 's <code>workman</code> tool manages my (ever increasing number of) checkouts: <a href="#narrow/stream/122651-general/topic/working.20directory.20management/near/160277023" title="#narrow/stream/122651-general/topic/working.20directory.20management/near/160277023">https://rust-lang.zulipchat.com/#narrow/stream/122651-general/topic/working.20directory.20management/near/160277023</a></p>



<a name="165551346"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/x.py%20vs%20branches/near/165551346" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> davidtwco <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/x.2Epy.20vs.20branches.html#165551346">(May 13 2019 at 17:49)</a>:</h4>
<p><span class="user-mention" data-user-id="124288">@oli</span> was kind enough to contribute some features earlier in the week too.</p>



<a name="165551451"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/x.py%20vs%20branches/near/165551451" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> davidtwco <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/x.2Epy.20vs.20branches.html#165551451">(May 13 2019 at 17:50)</a>:</h4>
<p>I also use it to have a working directory that it’ll never assign for me to use but will keep up to date which is built without any optimisations. It’s slow but it works well with a debugger so I sometimes jump to that directory to understand what master is doing better when working on a PR, which has been helpful.</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>